package sort;

public class Insertionsort implements ISort {
	public void doSort(int[] elements) {
		if(elements == null || elements.length == 0) {
			return;
		}
		
		int i;
		int j;
		int newValue;
		
		for(i = 1; i < elements.length; i++) {
			newValue = elements[i];
			
			j = i;
			while(j > 0 && elements[j - 1] > newValue) {
				elements[j] = elements[j - 1];
				j--;
			}
		}
	}
}
